package tcu.iot.gasmanage.api;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import tcu.iot.gasmanage.common.Result;
import tcu.iot.gasmanage.service.EquipmentCardService;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@Api(value = "设备管理控制器")
@RestController
@RequestMapping("/equipmentCard")
@CrossOrigin
public class EquipmentCardController {

    @Resource
    private EquipmentCardService equipmentCardService;

    @ApiOperation(value = "/getEquipmentInfo", notes = "获得单个设备信息，显示在设备信息页")
    @GetMapping(value = "/getEquipmentInfo")
    public Result getEquipmentInfo(HttpServletRequest request){
        String equipmentNumber = request.getQueryString().replace("query=","");
        return equipmentCardService.getEquipmentInfo(equipmentNumber);
    }
}
